<template>
  <div class="myDialog">
    <el-dialog
      :visible.sync="visible"
      width="25%"
      class="confirm"
      :show-close="false"
      @close="close"
    >
      <div class="header">
        <div class="text">提示</div>
        <div class="iconfont icon" @click="close()">&#xe608;</div>
      </div>
      <div class="body">确定要删除吗？</div>
      <div class="footer">
        <my-button bgc="#fff" border="#DCDCDF" fontColor="#387CF7" @click="confirm">确定</my-button>
        <my-button bgc="#fff" border="#DCDCDF" fontColor="#88898E" @click="close()">取消</my-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import myButton from "@/components/myButton.vue";
export default {
  components: {
    myButton,
  },
  props: {
    show: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      visible: this.show,
    };
  },

  watch: {
    show() {
      this.visible = this.show;
    },
  },
  methods: {
    close() {
      this.$emit("update:show", false);
    },
    confirm() {
      this.$emit("confirm");
    },
  },
};
</script>

<style lang="less" scoped>
// 弹窗样式
.el-dialog__wrapper {
  /deep/ .el-dialog__header {
    padding: 0;
  }
  /deep/ .el-dialog__body {
    padding: 0px 0px;
    .header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      font-size: 18px;
      font-weight: bold;
      padding: 18px 28px;
      box-sizing: border-box;
      border-bottom: 1px solid #d7d7d7;
      .text {
        color: #000;
      }
      .icon {
        color: rgba(178, 178, 178);
        cursor: pointer;
        user-select: none;
      }
    }
    .body {
      width: 100%;
      height: 80px;
      line-height: 100px;
      text-align: center;
      color: #333;
      font-size: 18px;
    }
    .footer {
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 20px 0 40px 10px;
      .button {
        width: 120px;
        margin-right: 20px;
      }
    }
  }
  /deep/ .el-dialog__footer {
    padding: 0;
  }
}
</style>